﻿
//******************* star rating system ************************
$(".star").mouseover(function () {
    alert("hello");
});

$(".star").mouseout(function () {
    var span = $(this).parent("span");
    var rating = span.attr("rating");
    setRating(span, rating);
});

function setRating(span, rating) {
    span.find('img').each(function () {
        var value = parseFloat($(this).attr("value"));
        var imgSrc = $(this).attr("src");
        if (value <= rating)
            $(this).attr("src", imgSrc.replace("-off.gif", "-on.gif"));
        else
            $(this).attr("src",imgSrc.replace("-on.gif","-off.gif"));
    });
}